package cn.iocoder.yudao.module.contract.dal.mysql.order;

import java.math.BigDecimal;
import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.contract.controller.admin.order.vo.OrderDetailsPageReqVO;
import cn.iocoder.yudao.module.contract.controller.admin.order.vo.OrderDetailsRespVO;
import cn.iocoder.yudao.module.contract.dal.dataobject.order.OrderDetailsDO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import javax.annotation.Resource;

/**
 * 订单明细 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OrderDetailsMapper extends BaseMapperX<OrderDetailsDO> {

    default List<OrderDetailsDO> selectListByOrderId(Long orderId) {
        return selectList(OrderDetailsDO::getOrderId, orderId);
    }

    default int deleteByOrderId(Long orderId) {
        return delete(OrderDetailsDO::getOrderId, orderId);
    }

    IPage<OrderDetailsRespVO> selectOrderDetailsPage(IPage<OrderDetailsPageReqVO> page, @Param(Constants.WRAPPER) Wrapper<OrderDetailsPageReqVO> wrapper);

    /**
     * 根据订单Id获取订单金额
     * @param orderId
     * @return
     */
    List<OrderDetailsDO> getOrderMoneyById(@Param("orderId") long orderId);
}
